/**
 *
 * */
import { getStaticFile } from '@sutpc/axios';

export interface IConfig {
  env: string;
  acConfig: Map<string, any>;
}

let config: IConfig = null;

export const useStaticConfig = () => {
  const getConfig = async () => {
    if (!config) {
      const res = await getStaticFile('[publicPath]static/config.json');
      config = res;
      return config;
    } else {
      return config;
    }
  };

  return {
    getConfig
  };
};
